<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>

</head>

<body>
        <p>
            用户名:<input type="text" id="username" name="username"/>
        </p>
        <p>
            密码:<input type="text" id="password" name="password"/>
        </p>
        <p>
            <input type="button" value="提交" id="submit"/>
        </p>
        <script src="../js/jquery-1.12.4.js" type="text/javascript"></script>
        <script>
            $(function () {
                $("#submit").click(function () {
                    var username=$("#username").val();
                    var password=$("#password").val();
                    $.ajax({
                        "url":"login",
                        "type":"get",
                        "data":{username:username,password:password},
                        "dataType":"json",
                        "success":function (data) {
                            if(data=="true"){
                                location.href="main.html";
                            }else if(data=="false"){
                                location.href="toLogin.html"
                            }
                        }
                    })
                })
            })

        </script>
</body>
</html>